package com.tangyuewei.unirest.springbootunirest;

import kong.unirest.HttpResponse;
import kong.unirest.JsonNode;
import kong.unirest.Unirest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringBootUnirestApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringBootUnirestApplication.class, args);
        String tokenUrl = "";
        HttpResponse<JsonNode> tokenResult = Unirest.get(tokenUrl).queryString("data", "data").asJson();
        System.out.println(tokenResult.getBody());
        String token = tokenResult.getBody().getObject().getString("token");
        System.out.println(token);
        String msgUrl = "";
        HttpResponse<JsonNode> result = Unirest.request("POST", msgUrl)
                .field("token", token)
                .field("data", "data")
                .asJson();
        System.out.println(result.getBody());
    }

}
